<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
include_once("../config.inc.php");

$_LangPath = "10m1";	//語言檔參數，務必放在最前面
include_once(__Member_Path."/logincheck_nodb.php");
include_once(__Language_Path."/selectlanguage_member.php");

$fp = @file(__Membertemplate_Path."/10m1_".$_data["stype"].".html");
$fp = implode("", $fp);
$fp = setHTMLCharset($fp);
$fp = str_replace("{SelfFile}", $_SERVER["PHP_SELF"], $fp);
$fp = str_replace("{ShowAccount}", $_SESSION["Member_Info"] -> Account, $fp);
$fp = str_replace("{UserID}", $_SESSION["Member_Info"] -> ID, $fp);
$fp = str_replace("{sid}", $_data["sid"], $fp);

$intLID = (int)$_data["LottoID"];
if(empty($intLID))$intLID = 5;

$isSpecial = (int)$_data["isSpecial"];
if(empty($isSpecial))$isSpecial = 1;

include_once(__Common_Path."/SysParam.inc.php");
include_once(__Common_Path."/limit/LottoLimit_".$intLID.".inc.php");
include_once(__Common_Path."/betparam/BetParam_".$intLID.".inc.php");
include_once(__Root_Path."/tmp/credit-".$_SESSION["Member_Info"] -> ID.".php");
@include_once(__Common_Path."/todaygame/Gamble".$intLID.".inc.php");
include_once(__Common_Path."/Lotto.inc.php");
include_once(__Common_Path."/ExchangeRate.inc.php");
include_once(__Modules_Path."/ChangeTime.lib.php");

$MemExchangeRate = (empty($_ECRate[$_SESSION["Member_Info"] -> ERID]["Rate"]))?1:$_ECRate[$_SESSION["Member_Info"] -> ERID]["Rate"];
$intLType = $_arrLotto[$intLID]["LType"];
//取出此期賽程
if(is_array($_arrGamble))list($intGID, $arrGamble) = each($_arrGamble);

$intTmp = $_SESSION["Member_Info"] -> CreditLine - $_arrMemStake["_SUM"];
$fp = str_replace("{CreditValue}", $intTmp, $fp);

$fp = str_replace("{LottoID}", $intLID, $fp);
$fp = str_replace("{ColorSet}", $_arrLotto[$intLID]["ColorSet"], $fp);
$fp = str_replace("{DrawSpecial}", $_arrLotto[$intLID]["DrawSpecial"], $fp);
$fp = str_replace("{SpecialOverNumber}", $_arrLotto[$intLID]["SpecialOverNumber"], $fp);

if (!is_array($arrGamble)) {
	$strDate = "2100-01-01 01:01:01";
} else {
	$strDate = TimeForm($arrGamble[GameDate], $arrGamble[EndGameTime], "Y-m-d H:i:s", "UToC");
}
$fp = str_replace("{EndGameTime}", $strDate, $fp);
$fp = str_replace("{isSpecial}", $isSpecial, $fp);


	if($isSpecial == 1){
		$fp = str_replace("{Bet_Type}", $isSpecial.",2,3,4", $fp);
		if($_KSysParam[isOpenSpecialNumberBLine] == 1){
			$fp = preg_replace("/<!-- NormlSpecial Bar Start \/\/-->.+<!-- NormlSpecial Bar End \/\/-->/s", "", $fp);
			$fp = str_replace("<td class=\"rt_sp_nsbar\" id=\"NSBar".($isSpecial==1?"1":"2")."\">", "<td class=\"rt_sp_nsbar_sd\" id=\"NSBar".(string)((int)$isSpecial==1?"1":"2")."\">", $fp);
		}else{
			$fp = preg_replace("/<!-- NormlSpecial Bar Start \/\/-->.+<!-- SpecialNumber Bar End \/\/-->/s", "", $fp);
		}
	}else{
		$fp = str_replace("{Bet_Type}", $isSpecial, $fp);
		$fp = str_replace("<td class=\"rt_sp_nsbar\" id=\"NSBar".(string)($isSpecial%10)."\">", "<td class=\"rt_sp_nsbar_sd\" id=\"NSBar".(string)((int)$isSpecial%10)."\">", $fp);
		$fp = preg_replace("/<!--No Number Start\/\/-->.+<!--No Number End\/\/-->/s", "", $fp);
		$fp = preg_replace("/<!-- SpecialNumber Bar Start \/\/-->.+<!-- SpecialNumber Bar End \/\/-->/s", "", $fp);
		for($i = 1; $i <= 4; $i++){
			$fp = str_replace("{NSBar$i}", str_replace("1", $i, $_str10M1["NormalSpecial1"]), $fp);
		}
	}
	$fp = str_replace("{Title}", $_arrBet_Type[$intLType][$isSpecial], $fp);
	$fp = str_replace("{SpecialOdd}", $_str10M1["SpecialOdd"], $fp);
	$fp = str_replace("{SpecialEven}", $_str10M1["SpecialEven"], $fp);
	$fp = str_replace("{SpecialOver}", $_str10M1["SpecialOver"], $fp);
	$fp = str_replace("{SpecialUnder}", $_str10M1["SpecialUnder"], $fp);
	$fp = str_replace("{MSite}", "2", $fp);	//走馬燈位置
	$intBID = $isSpecial;
	$intGap = 0;

$fp = str_replace("{WType_SpA}", $_arrBet_Type[$intLType][1], $fp);
$fp = str_replace("{WType_NSB}", $_arrBet_Type[$intLType][21], $fp);
$intAN = 0;
if($_data["stype"] == "c"){
	$arrTmpBT = array(1, 2, 3, 4, 5, 6, 7, 8);
	while(list($k, $v) = each($arrTmpBT)){
		$fp = str_replace("{MaxEventLimitValue$v}", $_SESSION["Member_Info"] -> arrEventLimit[$intLID][$v], $fp);
		$fp = str_replace("{MaxBetLimitValue$v}", $_SESSION["Member_Info"] -> arrBetLimit[$intLID][$v], $fp);
		$fp = str_replace("{LottoMaxEventLimitValue$v}", floor($_arrLottoLimit[$v][0] / $MemExchangeRate), $fp);
		$fp = str_replace("{LottoMaxBetLimitValue$v}", floor($_arrLottoLimit[$v][1] / $MemExchangeRate), $fp);
		$fp = str_replace("{MinStake$v}", floor($_arrBetParam[$v][$intAN]["MinStake"] / $MemExchangeRate), $fp);
		$fp = str_replace("{MaxPayOff$v}", floor($_arrBetParam[$v][$intAN]["MaxPayOff"] / $MemExchangeRate), $fp);
	}

}
$fp = str_replace("{MaxEventLimitValue}", $_SESSION["Member_Info"] -> arrEventLimit[$intLID][$intBID], $fp);
$fp = str_replace("{MaxBetLimitValue}", $_SESSION["Member_Info"] -> arrBetLimit[$intLID][$intBID], $fp);
$fp = str_replace("{LottoMaxEventLimitValue}", floor($_arrLottoLimit[$intBID][0] / $MemExchangeRate), $fp);
$fp = str_replace("{LottoMaxBetLimitValue}", floor($_arrLottoLimit[$intBID][1] / $MemExchangeRate), $fp);
$fp = str_replace("{MinStakeValue}", floor($_arrBetParam[$intBID][$intAN]["MinStake"] / $MemExchangeRate), $fp); //最低下注金額
$fp = str_replace("{MaxPayOff}", $_arrBetParam[$intBID][$intAN]["MaxPayOff"], $fp);	//最高派彩

$fp = str_replace("{time}", "04", $fp);

while(list($k, $v) = each($_str10M1)){
	$fp = str_replace("{".$k."}", $v, $fp);
}

//輸出
WebOutputHTML($fp, 1);
?>